﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:props="clr-namespace:ScrumFactory.Windows.Properties"                    
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:SF_Converters="clr-namespace:ScrumFactory.Windows.Helpers.Converters;assembly=ScrumFactory.Windows.Helpers">

    <SF_Converters:ToLowerConverter x:Key="ToLowerConverter" />



    <Style x:Key="WindowTabControl" TargetType="{x:Type TabControl}">
        <Setter Property="Background" Value="{StaticResource PanelBackgroundBrush}"/>        
        <Setter Property="Padding" Value="0"/>                
        <Setter Property="BorderThickness" Value="0"/>                
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="TabItem">                    
             
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate  TargetType="{x:Type TabItem}">
                                <Grid Height="50" >
                                    <ContentPresenter x:Name="content" ContentSource="Header" Margin="25,0,5,0" Cursor="Hand" VerticalAlignment="Center">
                                        <ContentPresenter.Resources>
                                            <Style TargetType="{x:Type TextBlock}">
                                                <!--<Setter Property="Foreground" Value="{StaticResource TabItemBrush}"/>-->

                                                
                                                <Setter Property="Foreground" Value="White"/>
                                                <Setter Property="FontSize" Value="{StaticResource BigFontSize}"/>
                                                <Setter Property="FontFamily" Value="Segoe UI"/>
                                                <Setter Property="FontWeight" Value="Thin"/>
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding IsEspecialTab}" Value="True">
                                                        <Setter Property="Foreground" Value="{StaticResource TabItemEspecialBrush}"/>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </ContentPresenter.Resources>
                                        <!--<ContentPresenter.Style>
                                            <Style>
                                                <Style.Triggers>                                                    
                                                    <Trigger Property="ContentPresenter.IsMouseOver" Value="True">
                                                        <Setter Property="ContentPresenter.Effect">
                                                            <Setter.Value>
                                                                <DropShadowEffect ShadowDepth="0" BlurRadius="10" Color="White" />
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </ContentPresenter.Style>-->
                                    </ContentPresenter>
                                    <!--<Path 
                                        x:Name="arrow"
                                        Visibility="Collapsed" Margin="0,0,15,0"
                                        Fill="{StaticResource ToolBarBorderBrush}" Data="M 0 5 L 8 0 L 16 5 Z" HorizontalAlignment="Center" VerticalAlignment="Bottom" />-->
                                    <!--<Grid.Style>
                                        <Style>
                                            <Style.Triggers>
                                                <Trigger Property="Grid.IsMouseOver" Value="True">
                                                    <Setter Property="Grid.Background" Value="#96A564" />
                                                </Trigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Grid.Style>-->
                                </Grid>
                                    

                                <ControlTemplate.Triggers>                                   
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter TargetName="content" Property="ContentPresenter.Effect" Value="{x:Null}"/>
                                        <!--<Setter TargetName="arrow" Property="Path.Visibility" Value="Visible"/>-->
                                    </Trigger>
                                    <DataTrigger Binding="{Binding IsVisible}" Value="False">
                                        <Setter Property="Visibility" Value="Collapsed"/>
                                    </DataTrigger>

                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>                    
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Foreground" Value="{StaticResource TabSelectedItemBrush}"/>
                        </Trigger>
                        <!--<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TabControl}}, Path=Items.Count}" Value="1">
                            <Setter Property="Visibility" Value="Hidden"/>
                        </DataTrigger>-->
                    </Style.Triggers>
                </Style>
            </Setter.Value>
        </Setter>
       
    </Style>

    <Style x:Key="DockPanelTabControl"  TargetType="{x:Type TabControl}">
        <Setter Property="Background" Value="{StaticResource DockPanelLeftBackground}"/>
        
        
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="VerticalAlignment" Value="Top"/>
       
        <Setter Property="ItemContainerStyle">            
            <Setter.Value>
                <Style TargetType="TabItem">
                    <Setter Property="Content" Value="{Binding View}"/>                        
                    <Setter Property="Header" Value="{Binding PanelName}"/>                    
                    <Setter Property="Cursor" Value="Hand"/>
                    <Setter Property="Margin" Value="0"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type TabItem}">
                                <Grid x:Name="text" Margin="0,-2,0,0" Height="40">
                                    
                                    <!--<Image Width="20" Height="20" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0" >
                                        <Image.Style>
                                            <Style>
                                                <Setter Property="Image.Source" Value="{Binding ImageUrl}"/>
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding ImageUrl}" Value="{x:Null}">
                                                        <Setter Property="Image.Source" Value="/Images/logoloading.png"/>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Image.Style>
                                    </Image>-->
                                    <TextBlock
                                        x:Name="headerText" Margin="30,0,30,0" VerticalAlignment="Center"
                                        FontFamily="Segoe UI" FontWeight="SemiBold"
                                        FontSize="{StaticResource NormalFontSize}"                                        
                                        Foreground="{StaticResource DockPanelTabItemForeground}"
                                        Text="{TemplateBinding Header, Converter={StaticResource ToLowerConverter}}" />        
                                    <Grid.Style>
                                        <Style TargetType="Grid">
                                            <Style.Triggers>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter Property="Background"  Value="{StaticResource DockPanelOverTabItemBackground}"/>
                                                </Trigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Grid.Style>
                                
                                </Grid>
                                
                                <ControlTemplate.Triggers>                                    
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter TargetName="headerText" Property="TextBlock.Foreground"  Value="{StaticResource DockPanelSelectedTabItemForeground}"/>
                                        
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="False">
                                        <Setter TargetName="headerText" Property="TextBlock.Foreground"  Value="{StaticResource DockPanelTabItemForeground}"/>
                                    </Trigger>
                                    <!--                                                                  
                                    <Trigger Property="IsSelected" Value="False">
                                        <Setter TargetName="text" Property="TextBlock.Opacity"  Value="0.7"/>
                                    </Trigger>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter TargetName="text" Property="TextBlock.Opacity"  Value="0.9"/>
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter TargetName="text" Property="TextBlock.Opacity"  Value="1"/>
                                    </Trigger>-->
                                    <DataTrigger Binding="{Binding PanelPlacement}" Value="1">
                                        <Setter TargetName="text" Property="Visibility" Value="Collapsed"/>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding PanelPlacement}" Value="2">
                                        <Setter TargetName="text" Property="Visibility" Value="Collapsed"/>
                                    </DataTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>        
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    
                        <ContentPresenter x:Name="content" Content="{Binding}" VerticalAlignment="Stretch" />
                    
                    
                
                                
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            
            <Trigger Property="IsEnabled" Value="False">
                <!--<Setter Property="Visibility" Value="Collapsed"/>-->
                <!--<Setter Property="Height" Value="40"/>-->
            </Trigger>
            <Trigger Property="HasItems" Value="False">
                <Setter Property="Visibility" Value="Collapsed"/>
            </Trigger>
            <!--<DataTrigger Binding="{Binding IsDockPanelsEnabled}" Value="False">
                <Setter Property="IsEnabled" Value="False"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding IsDockPanelsEnabled}" Value="True">
                <Setter Property="IsEnabled" Value="True"/>
            </DataTrigger>-->
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding SelectedProject}" Value="{x:Null}"/>
                    <Condition Binding="{Binding OpenedWindows.Count}" Value="0"/>
                </MultiDataTrigger.Conditions>
                <MultiDataTrigger.Setters>
                    <Setter Property="IsEnabled" Value="True"/>
                </MultiDataTrigger.Setters>
            </MultiDataTrigger>

        </Style.Triggers>
    </Style>

    <Style TargetType="TabControl">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="TabItem">                    
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate  TargetType="{x:Type TabItem}">
                                <TextBlock Text="{TemplateBinding Header}" Style="{StaticResource HyperLinkTextBlock}" Margin="0,0,10,0" Cursor="Hand"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>                    
                </Style>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>